<style>
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.fee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav {background:#bbb;color:#fff;}	
</style>
<div class="fui-page fui-page-current">
<div class="fui-content" style='top:0;'>
	<div class="jy-content">
			<div class="fui-page-title c" style="margin-top:0.5rem">
					<img style="border-radius: 50%;padding:0.15rem;width:3rem;height:3rem;background-color: #f2f2f2;" src="../addons/jy_yangjidan/imgs/jimai.png" />
					<div class="red">挂卖平台</div>
			</div>
			<div class="tips tips-yellow">
				<i class="fa fa-bullhorn"></i> [<red>温馨提示</red>]：</br>满30个鸡蛋可以委托销售!
			</div>
			<div ng-if="pagedata.list.length>0" class="fui-cell-group radius" style="padding:0.5rem;padding-bottom:3rem;max-height:20rem;overflow-y:scroll">
					<div ng-repeat="item in pagedata.list" class="fui-cell" style="margin-bottom:0.3rem;padding:0.5rem;border-radius:0.5rem;">
						<div class="fui-cell-label">
							<img ng-if="item.type==0" style="border-radius: 50%;padding:0.15rem;width:3rem;height:3rem;background-color: #fff;" src="../addons/jy_yangjidan/imgs/jidan.png" />
							<img ng-if="item.type==1" style="border-radius: 50%;padding:0.15rem;width:3rem;height:3rem;background-color: #fff;" src="../addons/jy_yangjidan/imgs/xiaoji.png" />
						</div>
						<div class="fui-cell-text" style="font-size:0.65rem">
							<div ng-if="item.type==0">挂卖鸡蛋{{item.jdnum}}枚</div>
							<div ng-if="item.type==1">挂卖成鸡1只</div>
							<div class="sycolor">￥{{item.price}}</div>
							<div class="gray">回购日期:{{item.endday}}</div>
						</div>
						<div class="fui-cell-remark noremark">
							<div class="label label-success" ng-click="pagedata.nowitem=item;pagedata.tobuy=true">购买</div>
						</div>
					</div>
			</div>
			<div class="fui-navbar">
				<a href="javascript:;" ng-click="access_json('jy_yangjidan/myjiorder/')" class="nav-item btn cartbtn">
					<div class="fee-tag-nav">
						查看订单
					</div>
				</a>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.tobuy" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-bottom:2.5rem">
		<i class="closed icon icon-close" style="color:red;top:0.3rem" ng-click="pagedata.tobuy=false"></i>
		<div class="order-create-page modal-swiper-y" style='margin-top:1rem;background:#fff;'>
			<div ng-include="sys_html('_peisong')"></div>
			<div class="weui_cells">
			<div class="weui_cell">
					<div class="weui_cell_hd">
					<label class="weui_label">
					<div ng-if="pagedata.nowitem.type==0">鸡蛋{{pagedata.nowitem.jdnum}}枚</div>
					<div ng-if="pagedata.nowitem.type==1">成鸡1只</div>
					</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="sycolor">￥{{pagedata.nowitem.price}}</div>
					</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_hd">
					<label class="weui_label">
					<div>消费鸡蛋余额抵扣</div>
					</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<div class="sycolor">-￥{{pagedata.member.jifen2}}</div>
					</div>
			</div>
			</div>
		</div>
		<div class='fui-navbar' style="padding:0.35rem 1rem">
			<div ng-if="!pagedata.order_id" class="btn btn-danger btn-banf" style="margin:0;width:100%" ng-click="pagedata.pay_submit(pagedata.post,'jy_yangjidan/jimai/buy/id='+pagedata.nowitem.id)">提交</div>
			<div ng-if="pagedata.order_id" class="btn btn-danger btn-banf disabled" style="width:100%" ng-click="access_json('jy_yangjidan/myjiorder/')">查看订单</div>
		</div>
		</div>
	</div>
</div>
<script>
	scope.pagedata.loading=true;
	scope.tool.get_list('jy_yangjidan/jimai/list/',true);
	scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_yangjidan/jimai/list/');
	}
	scope.pagedata.pay_submit=function(post,post_url,complete_url){
		complete_url=complete_url?complete_url:'jy_yangjidan/myjiorder/'
		scope.post_json(post_url,post,function(result){
			if(result.order_id){
				scope.pagedata.order_id=result.order_id;
				scope.$evalAsync();
				scope.tool.pay(result.pay_id,function(res){
						if(res.type=='success'){
							scope.message('支付成功！','success',complete_url);
						}else{
							scope.message('支付失败！','success',complete_url);
						}
				},'','',complete_url,complete_url);
			}else{
				scope.message(result);
			}
		});
	}
</script>